Skip to content

CursorMoveAnimation

Base classes

Name Children Inherits
VariantAnimation
prettyqt.core.variantanimation
Base class for animations.

⋔ Inheritance diagram

graph TD
  2372041666["animations.CursorMoveAnimation"]
  3443495182["core.VariantAnimation"]
  2400666939["core.VariantAnimationMixin"]
  565069530["core.AbstractAnimationMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  2420859519["QtCore.QVariantAnimation"]
  2133980439["QtCore.QAbstractAnimation"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  3443495182 --> 2372041666
  2400666939 --> 3443495182
  565069530 --> 2400666939
  3227531497 --> 565069530
  2751680898 --> 3227531497
  2420859519 --> 3443495182
  2133980439 --> 2420859519
  3984060476 --> 2133980439
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: VariantAnimation

Animation to move mouse cursor. None for start / end uses current position.

Source code in prettyqt/animations/cursormoveanimation.py
class CursorMoveAnimation(core.VariantAnimation):
    """Animation to move mouse cursor. None for start / end uses current position."""

    def __init__(
        self,
        duration: int = 1000,
        start: datatypes.PointType | None = None,
        end: datatypes.PointType = (0, 0),
        easing: core.easingcurve.TypeStr = "in_out_sine",
        **kwargs,
    ):
        super().__init__(**kwargs)
        self.set_easing(easing)
        self.set_start_value(start)
        self.set_end_value(end)
        self.setDuration(duration)
        self.valueChanged.connect(gui.Cursor.setPos)

    def set_start_value(self, point: datatypes.PointType | None):
        """Set start position of mouse move."""
        point = gui.Cursor.pos() if point is None else datatypes.to_point(point)
        self.setStartValue(point)

    def set_end_value(self, point: datatypes.PointType | None):
        """Set start position of mouse move."""
        point = gui.Cursor.pos() if point is None else datatypes.to_point(point)
        self.setEndValue(point)

set_end_value(point: datatypes.PointType | None)

Set start position of mouse move.

Source code in prettyqt/animations/cursormoveanimation.py
def set_end_value(self, point: datatypes.PointType | None):
    """Set start position of mouse move."""
    point = gui.Cursor.pos() if point is None else datatypes.to_point(point)
    self.setEndValue(point)

set_start_value(point: datatypes.PointType | None)

Set start position of mouse move.

Source code in prettyqt/animations/cursormoveanimation.py
def set_start_value(self, point: datatypes.PointType | None):
    """Set start position of mouse move."""
    point = gui.Cursor.pos() if point is None else datatypes.to_point(point)
    self.setStartValue(point)

:fa-brands-github: Show source on GitHub